<?php

abstract class Veneer_Controller_Rss extends Zend_Controller_Action
{
/*	Variables
	array - jsZone
*/
	protected $veneer_parms;	// array of parms
	protected $config;	// array of parms

	function init()
	{
		$this->view->baseUrl = $this->_request->getBaseUrl();
		foreach($this->_dbArray as $tableName)
		{
			Zend_Loader::loadClass($tableName,'modules/'. $this->_moduleName . '/models');
		}
		$this->veneer_parms = $this->_getAllParams();
		// load config.ini

		$this->_helper->LayoutManager->disableLayouts();

	}

 	function preDispatch()
	{//*******************************************************
		// authorization
		// security
	}
    public function __call($method, $args)
    {
		// No action
    }

   public function listHelper()
    {
		/*
	set the view
*/
    }

    public function addHelper($formArray)
    {
		// specify, validators, conditionals, and filters.
		//
		static  $formArrayTemplate = array(
			'fieldName'=>array('validatorName1'=>null,
						'validatorName2'=>array('parms')),
			'fieldName1'=>array('validatorName1'=>null,
						'validatorName2'=>array('parm1','parm2')),
			'fieldName2'=>array('validatorName1'=>null,
						'validatorName2'=>array('parm1','parm2',
									'message'=>'custom error message'))
		);

		$form = new Zend_Form($formArray);
        if ($this->getRequest()->isPost()) {
			$form->setDataSource($_POST);
			$form->addField('artist');
			$form->addField('title');
		    if ($form->isValid()) {
		        $album = new Album();
	        	$data = $form->getData();
    			$album->insert($data);

        	    $this->_redirect('/album');
        	    return;
            }
        }

        // set up an "empty" album
        $this->view->album = new stdClass();
        $this->view->album->id = null;
        $this->view->album->artist = '';
        $this->view->album->title = '';

        $this->render();
	}
    public function deleteHelper()
    {
		/*
	set the view
*/
    }
    public function editHelper()
    {
		/*
	set the view
*/
    }

}

